const express = require("express");
const bodyParser = require("body-parser");
const Reg = require("./routers/Reg")
const login = require("./routers/login")
const hairProjects = require("./routers/hairProject")
const member = require("./routers/member")
const Cbooking = require("./routers/Cbooking")
const Staff = require("./routers/staff")
const Performance = require("./routers/performance")
const path = require("path")
const cors = require("cors")
const db = require("./db/index")
const app = express();
app.use("/", async (req, res, next) => {
    await db;
    next();
});
app.use(express.static(path.join(__dirname, 'public')));
app.use(bodyParser.urlencoded({
    extended: true
}));
app.use(Reg);
app.use(login)
app.use(hairProjects)
app.use(member)
app.use(Cbooking)
app.use(Staff)
app.use(Performance)
app.use(cors())
app.listen(3000, err => {
    if (!err) console.log("启动成功");
    else console.log(err);
})